<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>核销3</title>
    <style>
            body,p{
            margin: 0%;
            padding: 0%;
        }
        body{
            height: 100%;
            background-color: #a8aeff;
        }
        #wrapper{
            height: 100%;
            background-size: cover;
            line-height: 100%;
        }

        #form{
            width: 70%;
            height: 150px;
            margin: 0 auto;
            vertical-align: middle;
            position: relative;
            top: 30%;
            z-index: 10;
            text-align: center;

        }
        .op-form{
            opacity: .5;
            background-color:white;
            width: 70%;
            height: 126px;
            margin: 0 auto;
            position: absolute;
            top: 30%;
            left: 15%;
            z-index: 6;
            text-align: center;
        }

        input{
            height: 20px;
            width: 60vw;
            border-block-end-style: none;

        }
        .tool{
            width: 140px;
            margin: auto;
            display: flex;
            justify-content: space-between
        }
        .tool>button{
            display: block;
            width: 60px;
            height: 30px;
        }
    </style>
</head>
<body>
<div id="wrapper">
    <div class="op-form"></div>
    <div id="form">
        <form style="text-align: center">
            <p style="text-align: center; margin-top: 5px;">核销码</p>
            <br>
            <p><input type="text" name="" id="input"  placeholder="请输入核销码..."></p>
            <br>
            <p class="tool"><button id="confirm">确认</button><button id="reset">重置</button></p>
        </form>
    </div>
</div>

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script>
    $(function(){
        $("#reset").on("click",function(){
            $("#input").val("");
            return false;
        });

        $("#confirm").on("click",function(){
            if($("#input").val() != "") {
                $.ajax({
                    url: '/admin/exchange',
                    type: 'post',
                    dataType: 'json',
                    data: {
                        "password": $("#input").val(),
                        "exchange_id":{$exchange_id},
                        "sign":"{$sign}",
                    },
                    success: function (data) {
                        alert(data.msg);
                    },
                    fail: function (err) {
                        console.log(err);
                    }
                });
            }else{
                alert("核销码不能为空！");
            }
            return false;
        });
    });
</script>
</body>
</html>